home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / misc-part2 / 10647 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  6.0 KB

  1. Path: blue.cse.ogi.edu!leneis
  2. From: leneis@blue.cse.ogi.edu (Tony Leneis)
  3. Newsgroups: comp.sys.amiga.misc
  4. Subject: Re: AmigaOS 4.x features
  5. Date: 31 Mar 1996 05:56:11 GMT
  6. Organization: Oregon Graduate Institute (OGI), Portland, Oregon
  7. Message-ID: <4jl6pr$knv@reuter.cse.ogi.edu>
  8. References: <4j7ein$a6v@B1FF.mindspring.com> <4jfm8i$b5n@B1FF.mindspring.com> <4jgc6q$a61@reuter.cse.ogi.edu> <4jkg5j$dva@B1FF.mindspring.com>
  9. NNTP-Posting-Host: blue.cse.ogi.edu
  10.  
  11. In article <4jkg5j$dva@B1FF.mindspring.com>,
  12. Charlie Moody <chmood@photobooks.atdc.gatech.edu> wrote:
  13. >On 29 Mar 1996 09:57:46 GMT, Tony Leneis wrote:
  14. >:     I'll grant that * is easier than #?, but the Amiga pattern matching
  15. >: is more powerful than traditional UNIX globbing.  As was pointed out earlier,
  16. >: you can always enable a UNIX-ish * by using a utility like wildstar.
  17. >
  18. >It may be *as* powerful, but not moreso (and what the heck is 'UNIX 
  19. >globbing'?), and certainly not as well thought out.  And that's the point 
  20. >about enabling the '*':  it's easy, and not nearly as useful as it would 
  21. >be in context.
  22.  
  23.     First, globbing is filename wildcarding.  Since some UNIX programs
  24. do regexp patterns and others do glob patterns, you need to make the
  25. distinction.  Regexp pattern matching is much more powerful than globbing,
  26. but it's not as convenient to express.  When I say that the Amiga pattern
  27. matching is more powerful than globbing, I mean there are patterns that
  28. Amiga pattern matching can express which globbing cannot.  For example:
  29.  
  30. test#a       <- Matches 'test', 'testa', 'testaa', 'testaaa', etc.
  31. test#(ab)c   <- Matches 'testc', 'testabc', 'testababc', 'testabababc', etc.
  32. ~(#?.info)   <- Matches anything that doesn't end in '.info'
  33.                 * To be fair, a few UNIX shells provide this functionality
  34. exp(ab|cd).c <- Matches 'expab.c' and 'expcd.c'
  35.                 * Again, _some_ UNIX shells provide this functionality
  36.  
  37. On the other hand, there are no UNIX globbing patterns which cannot be
  38. expressed as an Amiga pattern.  Hence, Amiga patterns are more powerful.
  39.  
  40. >Yes, I can get the same effect as in can under unix pattern-matching...all
  41. >I have to do is use a completely different, much more cumbersome, and much 
  42. >less intuitive (read: badly designed) method. 
  43.  
  44. It's different, because it's essentially allowing you to do full regular
  45. expressions.  Would you have preferred the standard UNIX regular expression
  46. syntax?  Then you'd have to type '.*' instead of '#?', and you'd have to
  47. remember to escape the '.' whenever you didn't want it to act as the Amiga
  48. '?' metacharacter.  (Kind of a bummer if you're looking for '#?.c', or should
  49. I say '.*\.c' as a UNIX regular expression.)
  50.  
  51. Where UNIX has two different pattern-matching systems that you have to learn,
  52. the Amiga has one.  Seems much simpler to me.  (Never mind the fact that each
  53. UNIX shell and utility seems to have it's own special little modification to
  54. glob patterns and regexp patterns.)
  55.  
  56. >That's not "more flexible";  it's not "more powerful";  and it sure as 
  57. >h*ll ain't any easier.  Isn't it basic common sense to avoid re-inventing 
  58. >the wheel *whenever* possible?
  59.  
  60. As mentioned above, it is more flexible and more powerful, because anything
  61. that can be expressed as a UNIX glob pattern can be expressed as an Amiga
  62. pattern, and then some.  Just out of curiosity, whose wheel should they have
  63. used instead of inventing their own?  As far as I know, there was no RFC or
  64. other standard for file wildcarding when AmigaDOS was developed.  Which UNIX
  65. shell should they have followed?  Or, should they have done it like VMS?  MVS?
  66. MS-DOS?  Each of these does pattern matching in different ways.
  67.  
  68. >: For example, "dir sys:(a|b|c|e)#?".
  69. >
  70. >[additional references to documentation for more counter-intuitive,]
  71. >[anti-logical methods deleted]
  72. >
  73. >        dir sys:[a-e]*
  74. >
  75. >Logical, simple, fast:  elegant.
  76.  
  77.     Well, you can certainly do it with a current version of AmigaDOS.
  78. So, what's the problem?  One minor nit - that should be 'dir sys:[a-ce]*'
  79. if you want it to be the same as the 1.3 AmigaDOS pattern matching example
  80. above.  One thing I'd like to see added is the ability to compliment sets.
  81. i.e. [^abc] matches anything except 'a', 'b', or 'c'.
  82.  
  83. >; The main problem,
  84. >: if you want to call it a problem, is that it's different.  It also can be a
  85. >: little more awkward to use for certain patterns, but it always can get the
  86. >: job done.  
  87. >
  88. >The fact that the kludge can be worked around does nothing to redeem the 
  89. >kludge.  It's still bad design with no significant benefit from making 
  90. >the sacrifices, and it should be thrown overboard at the first opportunity.
  91.  
  92. It's not a kludge, and there's nothing wrong with the design.  It is much
  93. more useful than MS-DOS or UNIX globbing.  If I wanted that, I'd just run
  94. Linux or CrossPC on my Amiga.
  95.  
  96. Throwing the Amiga pattern matching overboard would not only reduce the power
  97. of AmigaDOS, it would also reduce the power of editors and other applicaitons
  98. and utilities that allow you to do pattern matching.  I'd rather see Amiga
  99. pattern matching extended and perhaps made more efficient (efficient as in
  100. time it takes for the pattern-matching code to run.)
  101.  
  102. >: I'd certainly take the functionality of the # operator any day
  103. >: over the UNIX * operator (provided I've got a match-any-character operator
  104. >: to go with it.)
  105. >
  106. >You'd gladly throw away the match-any-character option, provided you've 
  107. >got a match-any-character option to replace it???
  108.  
  109. No.  The UNIX * operator is match-any-sequence-of-characters.  The UNIX ? and
  110. the AmigaDOS ? operator is match-any-character.  The AmigaDOS # operator is
  111. match-any-number-of.  So, I'd prefer the ability to match any number of
  112. arbitrary patterns, provided I had a way to match any character, rather than
  113. only being able to match any sequence of characters.
  114.  
  115. -Tony
  116. -- 
  117. =====///===Hi!==I'm=a=.signature=virus!==Copy=me=to=your=.signature!===///==
  118. __  /// leneis@cse.ogi.edu          From the desk of:   Hillary,  __  ///   
  119. \\\///  tony@plaza.ds.adp.com       -->Tony Leneis<--   Gennifer, \\\///Only
  120.  \XX/   aleneis@gauss.math.hmc.edu  HMC '91  Go Stags!  AND NOW US!\XX/Amiga
  121.